home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / mu17_ext.zip / INPUTHAN.A < prev    next >
Text File  |  1994-03-07  |  2KB  |  57 lines

  1.        CSECT   InputHandler             ;SAS/Lattice ASM command requires this
  2. *
  3.         INCLUDE "include:exec/types.i"
  4.         INCLUDE "include:exec/io.i"
  5.         INCLUDE "include:devices/inputevent.i"
  6. *
  7.  
  8.         xdef    _ButtonSwap
  9.  
  10. _ButtonSwap:    move.l  a0,-(sp)        ; Save the event list
  11. CheckLoop:      move.w  ie_Qualifier(a0),d1             ; Get qualifiers...
  12.         and.w   #$7F,d1                ; clear control
  13.         cmp.w    #IEQUALIFIER_LSHIFT,d1        ; is it a shift
  14.         beq    NoSaveQual
  15.         cmp.w   #IEQUALIFIER_RSHIFT,d1        ; is it right shift
  16.         beq    NoSaveQual
  17.         cmp.w    #IEQUALIFIER_CONTROL,d1        ; control button
  18.         beq     NoSaveQual
  19. SaveQual:       move.w  #0,ie_Qualifier(a0)             ; Save back...
  20. NoSaveQual:    NOP
  21. *
  22. * The actual button up/down events are transmitted as the
  23. * code field in RAWMOUSE events.  The code field must the be
  24. * checked and modified when needed on RAWMOUSE events.  If the
  25. * event is not a RAWMOUSE, we are done with it.
  26. *
  27.                 move.w  ie_Code(a0),d0                  ; Get code...
  28.                 move.w  d0,d1                           ; Save...
  29.                 and.w   #$7F,d0                         ; Mask UP_PREFIX
  30.                 cmp.w   #IECODE_LBUTTON,d0              ; Check for Left...
  31.                 beq.s   SwapThem                        ; If so, swap...
  32.                 bra.s   NextEvent                       ; If not, next...
  33. *
  34. SwapThem:       eor.w   #1,d1                           ; Flip bottom bit
  35.                 move.w  d1,ie_Code(a0)                  ; Save it...
  36.  
  37. *    
  38. * The event list is linked via a pointer to the next event
  39. * in the first element of the structure.  That is why it is not
  40. * nessesary to use:  move.l ie_NextEvent(a0),d0
  41. *
  42. * The reason I move to d0 first is that this also checks for zero.
  43. * The last event in the list will have a NULL ie_NextEvent field.
  44. * This is NOT as standard EXEC list where the node after the last
  45. * node is NULL.  Input events are single-linked for performance.
  46. *
  47. NextEvent:      move.l  (a0),d0                         ; Get next event
  48.                 move.l  d0,a0                           ; into a0...
  49.                 bne.s   CheckLoop                       ; Do some more.
  50. *
  51. * All done, just return the event list...  (in d0)
  52. *
  53.                 move.l  (sp)+,d0        ; Get event list back...
  54.                 rts                     ; return from handler...
  55. *
  56.                END
  57.